# configure and define platform stuff here
function(GConfigurePlatform)

	MESSAGE(STATUS "Build host platform is ${CMAKE_HOST_SYSTEM_NAME}.")
	
	#decide host platform
	if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
		SET(G_HOST_PLATFORM_LINUX TRUE)
		SET(G_HOST_PLATFORM "Linux")
	elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
		SET(G_HOST_PLATFORM_WINDOWS TRUE)
		SET(G_HOST_PLATFORM "Windows")
	elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
		SET(G_HOST_PLATFORM_DARWIN TRUE)
		SET(G_HOST_PLATFORM "Darwin")
	else ()
		MESSAGE(FATAL_ERROR "Build target platform is not supported.")
	endif ()
	
	# let user choose target platform
	set(G_TARGET_PLATFORM "Windows" CACHE STRING "Choose one of Windows, Linux or Darwin")
	
	# set target platform to cmake
	set(CMAKE_SYSTEM_NAME ${G_TARGET_PLATFORM})
	
	MESSAGE(STATUS "Build target platform is ${CMAKE_SYSTEM_NAME}.")
	
	#decide target platform
	if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
		SET(G_TARGET_PLATFORM_LINUX TRUE)
	elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
		SET(G_TARGET_PLATFORM_WINDOWS TRUE)
	elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
		SET(G_TARGET_PLATFORM_DARWIN TRUE)
	else ()
		MESSAGE(FATAL_ERROR "Build target platform is not supported.")
	endif ()
	
	# define platform preprocessor
	STRING(TOUPPER ${G_TARGET_PLATFORM} PLATFORM_NAME_UPPER)
	ADD_DEFINITIONS(-DG_PLATFORM_${PLATFORM_NAME_UPPER})
	ADD_DEFINITIONS(-DG_PLATFORM="${G_TARGET_PLATFORM}")
	
endfunction()